import urllib.request


# GET请求的 QUOTE方法

header = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
url = 'https://www.baidu.com/s?wd='

# 需要把参数URL编码化
keyword = '周杰伦'
keyword = urllib.parse.quote(keyword)
# 再合并
url += keyword

reqObject = urllib.request.Request(url=url, headers=header)
respObjet = urllib.request.urlopen(reqObject)

html = respObjet.read().decode('UTF-8')
print(html)
